package com.neusoft.neuiotms.common.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;

import org.hibernate.validator.constraints.Length;

import com.neusoft.bizcore.web.jpa.model.AbstractModel;
import com.neusoft.bizcore.web.jpa.model.Comment;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

@Getter
@Setter
@ToString
@Entity
@org.hibernate.annotations.Table(appliesTo = "neuiot_dictionary", comment = "字典表")
@Table(name = "neuiot_dictionary")
public class Dictionary extends AbstractModel {

    private static final long serialVersionUID = 1L;

    /** 编码 */
    @NotBlank(message = "编码不能为空")
    @Length(max = 255, message = "编码不能超过{max}位")
    @Column(length = 255, nullable = false)
    @Comment("varchar(255) NOT NULL COMMENT '编码'")
    private String code;

    /** 文本 */
    @NotBlank(message = "文本不能为空")
    @Length(max = 255, message = "文本不能超过{max}位")
    @Column(length = 255, nullable = false)
    @Comment("varchar(255) NOT NULL COMMENT '文本'")
    private String text;

    @Comment("int(11) NOT NULL COMMENT '顺序'")
    private int sort = 0;

    @ManyToOne
    private DictionaryType dictionaryType;

}
